﻿using Core.Battle;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core
{
    public class BaseEntity : IEntity
    {
        
        public virtual string Name { get; }
        public virtual int HP { 
            get
            {
                return hp;
            }
            set
            {
                if (value < hp)
                {
                    hp = (hp + value) / 2;
                    Shield -= (hp - value);
                }
                else
                {
                    hp = value;
                }
            }
        }
        public virtual int Shield { get; set; }
        public virtual int Speed { get; }

        public IEnumerable<IEffect> Effects => effects;

        protected int hp;

        private List<IEffect> effects = new List<IEffect>();


        public IEntityController Controller { get; set; }

        public void AddEffect(IEffect effect)
        {
            effects.Add(effect);
        }

        public void RemoveEffect(IEffect effect)
        {
            effects.Remove(effect);
        }
    }
}
